/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.documents.service.knowledge;

import com.documents.common.core.PageBean;
import com.documents.common.core.service.BaseSrv;
import com.documents.pojo.KnowledgeArea;
import java.util.List;

/**
 *
 * @author Administrator
 */
public class KnowledgeAreaService extends BaseSrv<KnowledgeArea, Integer> {
    public PageBean getPageBean(int page, int pageSize, KnowledgeArea area) {
        PageBean pageBean = new PageBean();
        pageBean.setPageSize(pageSize);
        pageBean.setCurrentPage(page);
        String condition = "";
        Object[] parameters = new Object[1];
       
            Long allRow = this.findTotalCount("", null);
            int totalPage = PageBean.countTotalPage(pageSize, allRow.intValue()); // 总页数
            pageBean.setAllRow(allRow.intValue());
            pageBean.setTotalPage(totalPage);
             List<KnowledgeArea> list;
            if (page == 1) {
                list = this.findWithPaging(condition, parameters, "id", page-1, pageSize);
            } else {
                list = this.findWithPaging(condition, parameters, "id", (page - 1) * pageSize, pageSize);
            }

            pageBean.setList(list);
       
        return pageBean;
    }
    
}

